package com.zhdl.common.ytools;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class AsciiToHexTools {

    public static String hexToAscii(String hex_str) {

        hex_str = hex_str.replace(" ", "").replace("0x", "").replace("\\x", "");
        StringBuilder ascii_str = new StringBuilder();
        for (int i = 0; i < hex_str.length(); i += 2) {
            String str = hex_str.substring(i, i + 2);
            ascii_str.append((char) Integer.parseInt(str, 16));
        }
        return ascii_str.toString();
    }

}
